package com.yu.crm.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yu.crm.domain.pojo.PubUserActionLog;
import com.yu.crm.domain.request.PubUserActionLogReq;
import com.yu.crm.domain.request.UserActionLogListReq;
import com.yu.crm.service.impl.PubUserActionLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

/**
 * 用户行为记录表 前端控制器
 *
 * @author song
 * @since 2019-12-28
 */
@RestController
@RequestMapping("/pub-user-action-log")
@Api(value = "用户行为记录",tags = {"用户行为记录"})
public class PubUserActionLogController {

    @Autowired
    PubUserActionLogService pubUserActionLogService;

    /**
     * 用户行为审计保存
     * @param req
     */
    @PostMapping("save-log")
    @ApiOperation(value = "用户行为审计保存")
    public void saveLog(@RequestBody PubUserActionLogReq req) {
        pubUserActionLogService.saveLog(req);
    }

    /**
     * 用户行为审计列表
     * @param req
     */
    @GetMapping("list")
    @ApiOperation(value = "用户行为审计列表")
    public IPage<PubUserActionLog> logList(@ApiIgnore Page<PubUserActionLog> page, UserActionLogListReq req) {
        return pubUserActionLogService.logList(page,req);
    }

    /**
     * 用户行为审计删除
     */
    @GetMapping("del")
    @ApiOperation(value = "用户行为审计删除")
    public void del(@ApiParam(value = "审计id集合，多个id用逗号隔开", required = true) String ids) {
        pubUserActionLogService.del(ids);
    }

    /**
     * 详情
     */
    @GetMapping("detail")
    @ApiOperation(value = "用户行为审计详情")
    public PubUserActionLog detail(@ApiParam(value = "审计id", required = true) String id) {
        return pubUserActionLogService.detail(id);
    }


}
